package com.wz.project.tsjJob.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wz.framework.aspectj.lang.annotation.Log;
import com.wz.framework.aspectj.lang.enums.BusinessType;
import com.wz.project.tsjJob.domain.ViewJobTsj;
import com.wz.project.tsjJob.service.IViewJobTsjService;
import com.wz.framework.web.controller.BaseController;
import com.wz.framework.web.domain.AjaxResult;
import com.wz.common.utils.poi.ExcelUtil;
import com.wz.framework.web.page.TableDataInfo;

/**
 * 大屏显示Controller
 * 
 * @author wz
 * @date 2024-01-11
 */
@Controller
@RequestMapping("/tsjJob/tsjJob")
public class ViewJobTsjController extends BaseController
{
    private String prefix = "tsjJob/tsjJob";

    @Autowired
    private IViewJobTsjService viewJobTsjService;

//    @RequiresPermissions("tsjJob:tsjJob:view")
    @GetMapping()
    public String tsjJob()
    {
        return prefix + "/tsjJob";
    }

    /**
     * 查询大屏显示列表
     */
//    @RequiresPermissions("tsjJob:tsjJob:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ViewJobTsj viewJobTsj)
    {
        startPage();
        List<ViewJobTsj> list = viewJobTsjService.selectViewJobTsjList(viewJobTsj);
        return getDataTable(list);
    }

    /**
     * 导出大屏显示列表
     */
//    @RequiresPermissions("tsjJob:tsjJob:export")
    @Log(title = "大屏显示", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ViewJobTsj viewJobTsj)
    {
        List<ViewJobTsj> list = viewJobTsjService.selectViewJobTsjList(viewJobTsj);
        ExcelUtil<ViewJobTsj> util = new ExcelUtil<ViewJobTsj>(ViewJobTsj.class);
        return util.exportExcel(list, "tsjJob");
    }

    /**
     * 新增大屏显示
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存大屏显示
     */
    @RequiresPermissions("tsjJob:tsjJob:add")
    @Log(title = "大屏显示", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ViewJobTsj viewJobTsj)
    {
        return toAjax(viewJobTsjService.insertViewJobTsj(viewJobTsj));
    }

    /**
     * 修改大屏显示
     */
    @GetMapping("/edit/{jobId}")
    public String edit(@PathVariable("jobId") String jobId, ModelMap mmap)
    {
        ViewJobTsj viewJobTsj = viewJobTsjService.selectViewJobTsjById(jobId);
        mmap.put("viewJobTsj", viewJobTsj);
        return prefix + "/edit";
    }

    /**
     * 修改保存大屏显示
     */
    @RequiresPermissions("tsjJob:tsjJob:edit")
    @Log(title = "大屏显示", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ViewJobTsj viewJobTsj)
    {
        return toAjax(viewJobTsjService.updateViewJobTsj(viewJobTsj));
    }

    /**
     * 删除大屏显示
     */
    @RequiresPermissions("tsjJob:tsjJob:remove")
    @Log(title = "大屏显示", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(viewJobTsjService.deleteViewJobTsjByIds(ids));
    }
}
